export
default class {
        constructor() {}
        getPromotion(money) {
            const promotion = [{
                key: 1,
                money: 500,
                reduce: 50
            },
            {
                key: 2,
                money: 800,
                reduce: 60
            },
            {
                key: 3,
                money: 1000,
                reduce: 100
            },
            {
                key: 4,
                money: 2000,
                reduce: 300
            },
            {
                key: 5,
                money: 5000,
                reduce: 500
            },
            ];
            let final = 0;
            switch (true) {
            case(money >= promotion[0].money) && (money < promotion[1].money) : final = promotion[0].reduce;
                break;
            case (money >= promotion[1].money) && (money < promotion[2].money) : final = promotion[1].reduce;
                break;
            case (money >= promotion[2].money) && (money < promotion[3].money) : final = promotion[2].reduce;
                break;
            case (money >= promotion[3].money) && (money < promotion[4].money) : final = promotion[3].reduce;
                break;
            case (money - promotion[4].money > 0) : final = promotion[4].reduce;
                break;
            default:
                break
            }
            return final
        }
        getFinalMoney(money) {
            const promotion = [{
                key: 1,
                money: 500,
                reduce: 50
            },
            {
                key: 2,
                money: 800,
                reduce: 60
            },
            {
                key: 3,
                money: 1000,
                reduce: 100
            },
            {
                key: 4,
                money: 2000,
                reduce: 300
            },
            {
                key: 5,
                money: 5000,
                reduce: 500
            },
            ];
            let final = money;
            switch (true) {
            case(money >= promotion[0].money) && (money < promotion[1].money) : final = money - promotion[0].reduce;
                break;
            case (money >= promotion[1].money) && (money < promotion[2].money) : final = money - promotion[1].reduce;
                break;
            case (money >= promotion[2].money) && (money < promotion[3].money) : final = money - promotion[2].reduce;
                break;
            case (money >= promotion[3].money) && (money < promotion[4].money) : final = money - promotion[3].reduce;
                break;
            case (money - promotion[4].money > 0) : final = money - promotion[4].reduce;
                break;
            default:
                break
            }
            return final
        }
    }